using System;
using Sys.UI;
using System.DHTML;
using Sys.Net;

namespace Sys.Mvc
{
    public delegate void MvcAsyRequestDelegate(Dictionary source, DomEvent eventSource, Dictionary ajaxOption);
    public delegate void MvcCallback(AjaxContext context);
    public delegate void MvcXMLHttpRequest(XMLHttpRequest context);
    // Summary:
    //     Enumerates the AJAX script insertion modes.
    [Imported]
    public enum InsertionMode
    {
        // Summary:
        //     Replace the element.
        Replace = 0,
        //
        // Summary:
        //     Insert before the element.
        InsertBefore = 1,
        //
        // Summary:
        //     Insert after the element.
        InsertAfter = 2,
    }



    // Summary:
    //     Represents option settings running AJAX scripts in an MVC application.
    [Imported]
    public sealed class AjaxOptions
    {
        public AjaxOptions()
        {
        }

        // Summary:
        //     Gets or sets the junction to call for a confirmation.

        public string Confirm; // { get; set; }
        //
        // Summary:
        //     Gets or sets the HTTP method.
        public string HttpMethod; // { get; set; }

        //Summary:
        //    Gets or sets the insertion mode.
        public InsertionMode InsertionMode; // { get; set; }
        //
        // Summary:
        //     Gets or sets the loading element id.
        public string LoadingElementId; // { get; set; }
        //
        // Summary:
        //     Gets or sets the function to call on begin.
        public MvcCallback OnBegin; // { get; set; }
        //
        // Summary:
        //     Gets or sets the function to call on complete.
        public MvcCallback OnComplete; // { get; set; }
        //
        // Summary:
        //     Gets or sets the function to call on failure.
        public MvcCallback OnFailure; // { get; set; }
        //
        // Summary:
        //     Gets or sets the function to call on success.
        public MvcCallback OnSuccess; // { get; set; }
        //
        // Summary:
        //     Gets or sets the update target id.
        public string UpdateTargetId; // { get; set; }
        //
        // Summary:
        //     Gets or sets the URL.
        public string Url; // { get; set; }
    }

    [Imported]
    public sealed class AjaxContext
    {
        public WebRequest request
        {
            get { return null; }
        }
        DOMElement updateElement;
        DOMElement loadingElement;
        AjaxOptions ajaxOptions;
    }

    [Imported]
    public class HyperlinkSource
    {
        public string Href; //{ get; set; }
    }

    [Imported]
    static public class AsyncHyperlink
    {
        static public void HandleClick(HyperlinkSource source, DomEvent eventSource, AjaxOptions ajaxOption)
        {
        }

        static public void HandleClick(Dictionary source, DomEvent eventSource, Dictionary ajaxOption)
        {
        }
    }

    [Imported]
    static public class AsyncForm
    {
        static public void HandleSubmit(Dictionary source, DomEvent eventSource, Dictionary ajaxOption)
        {
        }
    }
}
